﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace ConsoleAssembly
{
    class TimeSpanTest
    {
        static void TimeSpanTestMain()
        {

            int[] nums = new int[100000];

            BuildArray(nums);

            TimeSpan duration;//计算时间间隔

            DisplayNums(nums);

            DisplayNums(nums);

            DisplayNums(nums);

            duration = Process.GetCurrentProcess().TotalProcessorTime;//获取该进程总处理时间

            Console.WriteLine("Time: " + duration.TotalSeconds);

            //duration = Process.GetCurrentProcess().Threads[0].UserProcessorTime.Subtract(duration);
            //Console.WriteLine("subtracttime:"+duration.TotalSeconds);
        }

        static void BuildArray(int[] arr)
        {

            for (int i = 0; i <= 99999; i++)

                arr[i] = i;

        }

        static void DisplayNums(int[] arr)
        {

            for (int i = 0; i <= arr.GetUpperBound(0); i++)

                Console.Write(arr[i] + " ");
        }

    }

}
